SEXEC

Syntax: SEXEC device_file,start,length,data
    or: SEXEC device_file,start[,length[,data[,extra[,type]]]
        (Minerva v1.80+)
    or: SEXEC [device_]file,start,length,data  (Toolkit II)
    or: SEXEC #channel,start,length,data   (SMS only)
Location: QL ROM, Toolkit II

In order for a program to be stored as an executable Job, it is necessary to store the machine code in a specified format on disk. The command SEXEC allows you to do this, taking a specified amount of code from memory and storing it in the specified file in a form which can later be EXECuted.

You will need to specify the start address of the machine code, the length of the code to be stored and the amount of data space to be given to the program when it is loaded back into memory (the data space represents the amount of working memory which is linked with the program when it is loaded, either for storing data at the end of the program or for the user stack).

The specified file name must include the name of the device to be used, unless Toolkit II is present, in which case the default program device is supported. If Toolkit II is present and the file already exists, you will be given the option of overwriting the file.

MINERVA NOTE:
On Minerva v1.80 (or later) the command SEXEC is practically the same as SBYTES. The only difference is the type parameter which defaults to 1 as opposed to 0 with SBYTES.

SMS NOTE:
The fourth variant of this command allows you to save the data to an already existing channel which is OPEN to a file, thus cutting down on the number of times you need to access the file.

CROSS-REFERENCE:
SEXEC_O is very similar. 
EXEC and EXEC_W allow you to load a program saved with SEXEC.
